using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class WeaponObject : MonoBehaviour
{
    public GameObject bullet;
    public Transform[] shootPos;
    public TankBase fatherObject;
    public void Fire()
    {
        for (int i = 0; i < shootPos.Length; i++)
        {
            //创建子弹
            GameObject obj = Instantiate(bullet, shootPos[i].position, shootPos[i].rotation);
            //设置子弹的拥有者
            BulletObject bulletObject = obj.GetComponent<BulletObject>();
            if (fatherObject != null)
                bulletObject.SetFather(fatherObject);
            else
            {
                Debug.Log(" 找不到子弹拥有者");
            }
        }

    }
}
